<include file="Public:header" />
<include file="Public:menu" menu_school="curr" />
<include file="Public:navibar" />
<include file="_sub_menu" locationindex="selected" />
<div id="main">
    <switch name="select">
    <case value="locationAdd">
        <h4>添加地点</h4>
        <hr class="dash" />
        <form action="__URL__/locationAdds" method="post">
            <table class="edit">
                <tr>
                    <td class="label">地名</td>
                    <td><input class="text" type="text" name="location_name" value="" /></td>
                </tr>
                <tr>
                    <td class="label">坐标</td>
                    <td><input class="text" type="text" name="location_point" value="" /></td>
                </tr>
                <tr>
                    <td class="label">状态</td>
                    <td><label><input type="checkbox" name="status" value="1" /> 屏蔽</label></td>
                </tr>
                <tr>
                    <td class="label">学校</td>
                    <td>
                        <ul class="lite">
                            <volist name="school" id="list">
                                <li>
                                    <input type="checkbox" name="school_id[]" value="{{$list.school_id}}" />&nbsp;{{$list.school_name}}
                                </li>
                            </volist>
                        </ul>
                    </td>
                </tr>
                <tr>
                    <td class="label"></td>
                    <td><button class="btn btn_silver fbold" type="submit" ><span>提交</span></button></td>
                </tr>
            </table>
        </form>
    </case>

    <case value="locationEdit">
        <h4>编辑地点</h4>
        <hr class="dash"/>
        <form action="__URL__/locationEdits" method="post">
            <table class="edit">
                <tr>
                    <td class="label" width="80">地名</td>
                    <td><input class="text" type="text" name="location_name" value="{{$location.location_name}}" /></td>
                </tr>
                <tr>
                    <td class="label">坐标</td>
                    <td><input class="text" type="text" name="location_point" value="{{$location.location_point}}" /></td>
                </tr>
                <tr>
                    <td class="label">状态</td>
                    <td><label><input type="checkbox" name="status" value="1" <eq name="location.status" value="0">checked</eq> /> 屏蔽</label></td>
                </tr>
                <notempty name="location.school">
                <tr>
                    <td class="label">所属学校</td>
                    <td>
                        <volist name="location.school" id="vo" >
                            <label><input type="checkbox" name="school_id[]" value="{{$vo.school_id}}" checked="checked"> {{$vo.school_name}}</label><br />
                        </volist>
                    </td>
                </tr>
                </notempty>
                <notempty name="school">
                <tr>
                    <td class="label">添加所属学校</td>
                    <td>
                        <ul class="lite">
                                <volist name="school" id="list">
                                    <li>
                                        <label><input type="checkbox" name="school_id[]" value="{{$list.school_id}}" /> {{$list.school_name}}</label>
                                    </li>
                                </volist>
                        </ul>
                    </td>
                </tr>
                </notempty>
                <tr>
                    <td class="label"></td>
                    <td><input type="hidden" name="location_id" value="{{$location.location_id}}" />
                        <button class="btn btn_silver fbold" type="submit"><span>提交</span></button></td>
                </tr>
            </table>
        </form>
    </case>

    <default />
    <h4>地点管理</h4>
    <hr class="dash"/>
    <div class="console">
        <form name="search" method="get" action="__URL__/locationIndex" class="right">
            <select class="select" name="type">
                <option value="location_name">地名</option>
                <option value="status">状态(0:正常/1:屏蔽)</option>
            </select>
            <input class="text" type="text" name="keyword" value="{{$keyword}}"  />
            <button class="btn btn_silver fbold" type="submit"><span>搜索</span></button>
        </form>
        <a href="__URL__/locationAdd" class="btn btn_silver btn_small fbold" ><span>添加地点</span></a>
    </div>
    <table class="list" width="100%">
        <thead>
            <tr>
                <th width="15%">名称</th>
                <th width="10%">坐标</th>
                <th width="10%">状态</th>
                <th width="15%">所属学校</th>
                <th>操作</th>
            </tr>
        </thead>
        <volist name="location" id="location">
            <tr>
                <td>{{$location.location_name}}</td>
                <td><if condition="$location.location_point eq ''">未知<else />{{$location.location_point}}</if></td>
            <td><eq name="location.status" value="1">正常<else />屏蔽</eq></td>
            <td>
            <volist name="location.school" id="school">
                <eq name="school.status" value="1">{{$school.school_name}},</eq>
            </volist>
            </td>
            <td>
                <a href="__URL__/locationEdit/location_id/{{$location.location_id}}">编辑</a>&nbsp;
                <a href="__URL__/locationDelete/location_id/{{$location.location_id}}" onclick="return confirm('是否确认提交？')">删除</a>&nbsp;
            </td>
            </tr>    
        </volist>
    </table>
    </switch>
</div>
<include file="Public:footer" />